<?php
//       PHPcongrats - Holiday and Birthday Mailer
//     
//    Copyright (C) 2011  Matthias Nass
//
//    This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
//
//    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
//
//    You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>.

session_start();

if ($_SESSION['loggedin'] == true){
     	?>
     <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     <html>
     <head>
     <title>Feiertag anlegen</title>
     <link rel="stylesheet" type="text/css" href="./styles.css">
     </head>
     <body>
     	<h2>PHPcongrats <img src='./icons/rosette.png' alt='Rosette'/></h2>
     	<h1>Feiertag hinzuf&uuml;gen <img src='./icons/date_add.png' alt='add holiday'/></h1>
     	<p class="message">
     	<?php if($_SESSION['message'] == ''){}else{?>
     	<img src='./icons/error.png' alt='attention'/> <?php echo $_SESSION['message']; }?>
     	</p>
     	<p>
     	<form action="./actionaddholiday.php" method="post">
     		<input type="text" name="name" value=<?php echo $_SESSION['savedName']?>> Vorname<br>
     		<select name="day">
     		<?php for($i=1;$i<32;$i++){
     		if($_SESSION['savedDay']==$i)
     		     {echo "<option value='".$i."' selected>".$i."</option>";}
     		else     
     		     {echo "<option value='".$i."'>".$i."</option>";}
             }?>
     		</select>
     		<select name="month">
     		<?php for($i=1;$i<13;$i++){
     		if($_SESSION['savedMonth']==$i)
     		     {echo "<option value='".$i."' selected>".$i."</option>";}
     		else 
     		     {echo "<option value='".$i."'>".$i."</option>";}
             }?>
             </select>	
     		<select name="year">
     		<?php for($i=2011;$i<2100;$i++){
     		if($_SESSION['savedYear']==$i)
     		     {echo "<option value='".$i."' selected>".$i."</option>";}
     		else 
     		     {echo "<option value='".$i."'>".$i."</option>";}
             }?>
     		</select>
     		<?php if ($_SESSION['savedRevising']=="on")
     		     {echo "<input type='checkbox' name='revising' checked>";}
     		else 
     		     {echo "<input type='checkbox' name='revising'>";}?>
     		 Wiederholend ja/nein<br>
     		 <input type="text" name="region" value=<?php echo $_SESSION['savedRegion']?>> Region<br>
     		 <input type="text" name="country" value=<?php echo $_SESSION['savedCountry']?>> Land<br>
     		<input type="submit" name="submit"><br>
     	</form>
     	<p>
     		<a href="./holidays.php"><img src='./icons/cross.png' alt='Cancel'/> Abbrechen</a>
     	</p>
     </body>
     </html>
     	<?php
     	$_SESSION['message'] = "";
}
else{
    $_SESSION['last_location'] = "./holidayadd.php";
	header( 'Location: http:./login.php' );
}
?>